{include file="./header" title="菜单管理" /}
<div class="container-fluid">

  <div class="btn-group">
    <a href="{:url('menu_add')}" class="btn btn-secondary" role="button">{:lang('添加')}</a>
  </div>
  <br />
  <br />
  
  <table class="table table-striped table-hover">
	{foreach name="sql" item="val"}
	{if condition="($val.pid eq 0)"}
	<tbody>
        <tr class="accordion-title table-info">
            <td>{$val.name}(id:{$val.tid})</td>
            <td>&nbsp;</td>
            <td>
            <span class="btn-group" style="float:right;">
            <a href="{:url('portal/post/add?tid='.$val['tid'])}" target="_blank" class="btn btn-primary">{:lang('添加文章')}</a>
            <a href="{:url('Portal/article_list?tid='.$val['tid'])}" class="btn btn-secondary">{:lang('查看文章')}</a>
            <a href="{:url('menu_edit?tid='.$val['tid'])}" class="btn btn-secondary">{:lang('编辑')}</a>
            <button  href="{:url('menu_delete?tid='.$val['tid'])}" class="btn btn-danger delete" >{:lang('删除')}</button >
            </span>
          </td>
        </tr>
        {foreach name="sql" item="val2"}
		{if condition="($val2.pid eq $val['tid'])"}
        <tr>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$val2.name}(id:{$val2.tid})</td>
            <td>&nbsp;</td>
            <td>
            <span class="btn-group" style="float:right;">
            <a href="{:url('/add/'.$val2['tid'])}" target="_blank" class="btn btn-primary">{:lang('添加文章')}</a>
            <a href="{:url('Portal/article_list?tid='.$val2['tid'])}" class="btn btn-secondary">{:lang('查看文章')}</a>
            <a href="{:url('menu_edit?tid='.$val2['tid'])}" class="btn btn-secondary">{:lang('编辑')}</a>
            <button href="{:url('menu_delete?tid='.$val2['tid'])}" class="btn btn-danger delete">{:lang('删除')}</button >
            </span>
            </td>
        </tr>
        {/if}
		{/foreach}
    </tbody>
    {/if}
	{/foreach}
  </table>

<script>
$(document).ready(function(e) {
    $(".delete").click(function(e) {
        var r = confirm("是否确定要删除当前栏目,此操作将会彻底删除当前栏目的子栏目与栏目下的所有文章");
		if(r == true){
			var url = $(this).attr('href');
			//alert(url);
			self.location=url;
		}
    });
});

</script>
</div>
{include file="./footer" /}